#include <iostream>
#include <vector>
using namespace std;

vector<string> dic;

bool check1(string &s, string &d) {
    //acde
    //ade
    //abcd
    //abc
    bool flag = false;
    long lend = d.length();
    long i = 0;
    while (i < lend) {
        char c1 = 0, c2 = 0;
        if (flag) {
            c1 = s[i+1];
        } else {
            c1 = s[i];
        }
        c2 = d[i];
        if (c1 != c2) {
            if (!flag) flag = true;
            else return false;
        } else {
            i++;
        }
    }
    return true;
}

bool check2(string &s, string &d) {
    //abcd
    //aecd
    bool flag = false;
    long len = s.length();
    long i = 0;
    while (i < len) {
        if (s[i] != d[i]) {
            if (!flag) flag = true;
            else return false;
        }
        i++;
    }
    return true;
}

bool check3(string &s, string &d) {
    //ade
    //acde
    //abc
    //abcd
    //m
    //is
    bool flag = false;
    long lens = s.length();
    long i = 0;
    while (i < lens) {
        char c1 = 0, c2 = 0;
        c1 = s[i];
        if (flag) {
            c2 = d[i + 1];
        } else {
            c2 = d[i];
        }
        if (c1 != c2) {
            if (!flag) flag = true;
            else return false;
        } else {
            i++;
        }
    }

    return true;
}

bool check(string &s, string& d) {
    long delta = s.length() - d.length();
    if (delta == 1) return check1(s, d);
    else if (delta == 0) return check2(s, d);
    else if (delta == -1) return check3(s, d);
    return false;
}

void solve(string& s) {
    string words = "";
    bool same = false;
    for (vector<string>::iterator it=dic.begin(); it!=dic.end(); it++) {
        if (s == *it) {
            same = true;
            break;
        }
        if (check(s, *it)) {
            words += " " + *it;
        }
    }
    if (same) {
        cout << s << " is correct" << endl;
    } else {
        cout << s << ":" << words << endl;
    }
}

int main() {
    string tmp;
    while (cin >> tmp) {
        dic = vector<string>();
        dic.push_back(tmp);
        while (cin >> tmp) {
            if (tmp == "#") break;
            dic.push_back(tmp);
        }
        while (cin >> tmp) {
            if (tmp == "#") break;
            solve(tmp);
        }
    }
    return 0;
}